//
//  QActivityWebVC.m
//  QoilPublic
//
//  Created by 杨凯 on 2017/5/17.
//  Copyright © 2017年 杨凯. All rights reserved.
//

#import "QActivityWebVC.h"

@interface QActivityWebVC ()<UIWebViewDelegate>
{
    UIWebView * _web;
    NSURLRequest *_request;
}

@end

@implementation QActivityWebVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self WebView];
}

- (id)init{
    self = [super init];
    if (self) {
        
        self.hidesBottomBarWhenPushed = YES;
        
    }
    return self;
}

-(void)WebView
{
    _web=[[UIWebView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight)];
    _request = [[NSURLRequest alloc]initWithURL:[NSURL URLWithString:_url]];
    _web.scalesPageToFit=YES;
    _web.delegate=self;
    [_web loadRequest:_request];
    [self.view addSubview:_web];
    
}
- (BOOL)webView:(UIWebView *)webView shouldStartLoadWithRequest:(NSURLRequest *)request navigationType:(UIWebViewNavigationType)navigationType{
    [QViewUtility showMBHudToView:self.view hideBg:YES];
    
    return YES;
}
- (void)webViewDidStartLoad:(UIWebView *)webView{
}
- (void)webViewDidFinishLoad:(UIWebView *)webView{
    
    [QViewUtility hideMBHudToView:self.view];
    
    self.title = [webView stringByEvaluatingJavaScriptFromString:@"document.title"];
}
- (void)webView:(UIWebView *)webView didFailLoadWithError:(NSError *)error{
    
    [QViewUtility hideMBHudToView:self.view];
    
}

@end
